import React from 'react';
import { ISurveyHook } from '../../../utils/Survey/SurveyHook';
import AuthCompount from '../../AuthCompount/AuthCompount';
// import Parser from './../../../utils/Parser';
import './FormCount.scss';

/**
 *  计算分数组件
 */
export default function FormCount(props: ISurveyHook) {
  return (
    <div id="FormCount">
      <div className="form_box">
        <div className="tit_box">
          <AuthCompount isShow={!!props.formObj.validatorData.required}>
            <div
              // tslint:disable-next-line:jsx-no-multiline-js
              className={props.formObj.subjectData.errMsg ? 'cl star' : 'star'}
            >
              *
            </div>
          </AuthCompount>
          <div className="cln">{props.formObj.subjectData.subjectName}</div>
          <div>
            {// tslint:disable-next-line:jsx-no-multiline-js
            props.formObj.subjectData.defaultValue
              ? props.formObj.subjectData.defaultValue.toFixed(
                  props.formObj.subjectData.decimalNum ? props.formObj.subjectData.decimalNum : 3
                )
              : 0}
          </div>
        </div>
      </div>
      <AuthCompount isShow={!!props.formObj.subjectData.explain}>
        <div className="explain">（说明：{props.formObj.subjectData.explain}）</div>
      </AuthCompount>
    </div>
  );
}
